Skip to content

Added claude auto reviewer#84

Merged
shrunyan merged 4 commits into
masterfrom
feat/add-claude-auto-reviewer
Jun 8, 2026
Merged

Added claude auto reviewer#84
shrunyan merged 4 commits into
masterfrom
feat/add-claude-auto-reviewer

Conversation

@mattezra

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread .github/workflows/claude-auto-reviewer.yml
Comment thread .github/workflows/claude-auto-reviewer.yml Outdated
Comment thread .github/workflows/claude-auto-reviewer.yml
@github-actions

Copy link
Copy Markdown
Contributor

Claude Auto Review — review of the reviewer 🙂

Nice, small, self-contained workflow. The security hygiene is good — pinned action SHAs with version comments, minimal permissions (contents: read, pull-requests: write), concurrency cancellation, a 15-minute timeout, a draft-PR skip, and an explicit --allowedTools allowlist that keeps Claude on a short leash. Using the pull_request event (not pull_request_target) is also the right call: fork PRs won't get ANTHROPIC_API_KEY, which is the safer trade-off even though it means external-contributor PRs go un-reviewed.

A few suggestions, left inline:

  1. fetch-depth: 1 — fine if Claude sticks to gh pr diff, but any git-based fallback (git log, git diff master..HEAD) will fail. Worth either accepting that constraint explicitly or bumping to fetch-depth: 0.
  2. No bot/doc filter — every Dependabot bump and README typo will trigger a paid Claude review. Adding paths-ignore and user.type != 'Bot' would cut noise and cost.
  3. Bash(gh pr comment:*) / gh pr view:* allowlist breadth — these globs let Claude operate on any PR in the repo, not just the current one. Combined with untrusted diff content in the prompt context, that's a (small) prompt-injection surface. Either drop the bash entries in favor of the MCP inline-comment tool, or scope them more tightly.

No blocking issues. The workflow as-written will work; the suggestions are about cost control and tightening the trust boundary.

@mattezra mattezra requested a review from shrunyan May 21, 2026 01:30
@mattezra mattezra self-assigned this May 21, 2026
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Comment thread .github/workflows/claude-auto-reviewer.yml
Comment thread .github/workflows/claude-auto-reviewer.yml
Comment thread .github/workflows/claude-auto-reviewer.yml
@github-actions

Copy link
Copy Markdown
Contributor

Claude Auto-Reviewer workflow — review

Nice, focused change. The workflow follows current best practices for this kind of action and the security posture is reasonable. Detailed notes left inline; summary here:

What's good

  • SHA-pinned actions (actions/checkout and claude-code-action) — protects against tag-retargeting supply-chain attacks.
  • pull_request event (not pull_request_target) — correct choice; secrets aren't exposed to untrusted fork code.
  • Least-privilege permissions (contents: read, pull-requests: write) — no broader scope than needed.
  • Concurrency group with cancel-in-progress — avoids redundant reviews when a PR is force-pushed mid-review.
  • timeout-minutes: 15 — bounded blast radius if the action hangs.
  • draft == false and bot filter — skips work that isn't ready for review.

Things to consider (see inline comments)

  1. Fork PRs will silently no-op — secrets aren't available on pull_request from forks. Acceptable, but worth documenting.
  2. Bash(gh pr comment:*) is broader than the intent — combined with prompt-injection from PR contents, a crafted diff could try to redirect comments to a different PR/repo within the token's scope. Tightening the pattern to embed the current PR number, plus a one-line prompt instruction pinning the target PR, is cheap defense in depth.
  3. Add workflow_dispatch: so reviews can be retriggered manually after errors or cancellations.

Minor / optional

  • fetch-depth: 1 is fine here since git isn't in --allowedTools — the reviewer relies on gh pr diff (API-based) for diff context. Leave as-is.
  • paths-ignore currently skips **/*.md and docs/**. Mixed PRs (code + markdown) will still trigger and the model will see everything, which is probably what you want.
  • Consider adding WebFetch to --allowedTools if you'd like the reviewer to be able to look up linked docs/issues mentioned in PR descriptions; skip if you'd rather keep the egress surface small.

No blocking issues from me.

Comment thread .github/workflows/claude-auto-reviewer.yml Outdated
@mattezra mattezra requested a review from shrunyan June 8, 2026 09:56
Comment thread .github/workflows/claude-auto-reviewer.yml
Comment thread .github/workflows/claude-auto-reviewer.yml
Comment thread .github/workflows/claude-auto-reviewer.yml
Comment thread .github/workflows/claude-auto-reviewer.yml
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Claude Review — Auto-reviewer workflow

Overall this is a solid, security-conscious workflow setup. The fundamentals are right:

  • SHA-pinned actions (actions/checkout and claude-code-action) with version comments — good supply-chain hygiene.
  • Minimal permissions (contents: read, pull-requests: write) — least-privilege, correct.
  • pull_request trigger (not pull_request_target) — avoids the classic privileged-token-on-untrusted-code footgun.
  • Concurrency group with cancel-in-progress — saves API spend on rapid pushes.
  • timeout-minutes: 15 — sensible bound.
  • Draft/bot filter on the job if: — avoids noisy reviews.

Things worth thinking about (none are blockers)

  1. fetch-depth: 1 — fine for the action's own gh pr diff (server-side) but breaks any local git history operations. See inline comment.
  2. Path filters — every PR triggers a review, including docs/lockfile-only changes. Adding paths-ignore would cut API spend with no quality loss.
  3. Fork PR behaviorpull_request means secrets aren't exposed to fork PRs, so this effectively only reviews internal-branch PRs. Probably intentional; just flagging.
  4. Bash(gh pr comment:*) is broad — see inline comment; could be scoped tighter or relied on less in favor of the inline-comment MCP tool that's already allowed.
  5. Naming nit — file is claude-auto-reviewer.yml, workflow name is Claude Auto Review. Either is fine; just slightly inconsistent.
  6. Failure observability — there's no notification on workflow failure. If the API key expires or the action breaks, you'll just silently stop getting reviews. Consider a notification step on failure() if these reviews are meant to be load-bearing.

Not flagged because they're fine

  • No id-token: write needed (using static API key, not OIDC).
  • No issues: write needed (PR comments go through pull-requests: write).
  • Action version 1.0.127 is pinned via SHA — appropriate.

Nice clean addition. Inline comments cover the specifics.

@shrunyan shrunyan merged commit 6f2524d into master Jun 8, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants